//
//  ButtonTableViewCell.m
//  SheShiDu
//
//  Created by 单剑秋 on 16/6/12.
//  Copyright © 2016年 单剑秋. All rights reserved.
//

#import "ButtonTableViewCell.h"

@implementation ButtonTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
   
        
//        self.contentView.backgroundColor = [UIColor cyanColor];
        
        self.materialButton = [UpDownButton buttonWithType:UIButtonTypeCustom];
        [_materialButton setTitle:@"一线材料" forState:UIControlStateNormal];
        [_materialButton setImage:[UIImage imageNamed:@"cailiao"] forState:UIControlStateNormal];
        [self.contentView addSubview:_materialButton];
        
        self.teamButton = [UpDownButton buttonWithType:UIButtonTypeCustom];
        [_teamButton setTitle:@"专业施工" forState:UIControlStateNormal];
        [_teamButton setImage:[UIImage imageNamed:@"shigong"] forState:UIControlStateNormal];
        [self.contentView addSubview:_teamButton];
        
        self.insureButton = [UpDownButton buttonWithType:UIButtonTypeCustom];
        [_insureButton setTitle:@"报价透明" forState:UIControlStateNormal];
        [_insureButton setImage:[UIImage imageNamed:@"baojia"] forState:UIControlStateNormal];
        [self.contentView addSubview:_insureButton];
        
        self.interestButton = [UpDownButton buttonWithType:UIButtonTypeCustom];
        [_interestButton setTitle:@"免息装修" forState:UIControlStateNormal];
        [_interestButton setImage:[UIImage imageNamed:@"mianxi"] forState:UIControlStateNormal];
        [self.contentView addSubview:_interestButton];
        
        self.manageButton = [UpDownButton buttonWithType:UIButtonTypeCustom];
        [_manageButton setTitle:@"理财服务" forState:UIControlStateNormal];
        [_manageButton setImage:[UIImage imageNamed:@"licai"] forState:UIControlStateNormal];
        [self.contentView addSubview:_manageButton];
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self .materialButton.frame = CGRectMake(20, 0, (self.contentView.frame.size.width - 40) / 5, (self.contentView.frame.size.width - 40) / 5);
    self.teamButton.frame = CGRectMake(self.materialButton.frame.origin.x + self.materialButton.frame.size.width, 8, (self.contentView.frame.size.width - 40) / 5, (self.contentView.frame.size.width - 40) / 5);
    self.insureButton.frame = CGRectMake(self.materialButton.frame.origin.x + self.materialButton.frame.size.width * 2, 14, (self.contentView.frame.size.width - 40) / 5, (self.contentView.frame.size.width - 40) / 5);
    self.interestButton.frame = CGRectMake(self.materialButton.frame.origin.x + self.materialButton.frame.size.width * 3, 8, (self.contentView.frame.size.width - 40) / 5, (self.contentView.frame.size.width - 40) / 5);
    self.manageButton.frame = CGRectMake(self.materialButton.frame.origin.x + self.materialButton.frame.size.width * 4, 0, (self.contentView.frame.size.width - 40) / 5, (self.contentView.frame.size.width - 40) / 5);
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
